
{% extends "layout.html" %}
{% block content %}
注册用户： <br> 
手机号码 ： <input type="text" name="phone" id="phone"> <br>
会员名称：<input type="text" name="name" id="name"> <br>
推荐人：<input type="text" name="tuijianren" id="tuijianren" value="{{username}}"> <br>
购买币数：<input type="text" name="count" id="count"> <br>
<input type="button" value="提交注册" onclick="reg()">

  <div id="message"></div>
<script type="text/javascript" src="{{url_for('static',filename='res/js/jquery.min.js')}}"></script>
<script>

function reg(){
    var phone = document.getElementById("phone").value;
    var name = document.getElementById("name").value;
    var tuijianren = document.getElementById("tuijianren").value;
    var count = document.getElementById("count").value;

    var postdata = {
        'mobile':phone,
        'truename':name,
        'rename':tuijianren,
        'signmoney':count,
        'csrf_token': "{{csrf_token()}}"
    };


    $.ajax({
       url: '{{url_for("public.register_user")}}',
       type: 'POST',
       data: postdata,
       success: function( data ) {
        var msg_html = '';
        msg_html += '<br>success:'+data.success+msg_html;
        msg_html += '<br>channel:'+data.channel;
        msg_html += '<br>ts:'+data.ts;
        document.getElementById('message').innerHTML = '<br>'+data.msg+msg_html+document.getElementById('message').innerHTML;
       }
    });

} 
</script>

{% endblock %}

